﻿@model kxcxw.Data.Entities.AdApply
@using kxcxw.Data.Common
@using KXCXW.Web.CommonClass
@{
    ViewBag.Title = "修改广告信息";
    Layout = "~/Views/Shared/_Layout.cshtml";
    AdHelper ah = new AdHelper(Server.MapPath("~/Content/xml/Adconfig.xml"));
    AdModel am = ah.getAdModelByBlockId(Model.AdBlockId);
}
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Content/datepicker/WdatePicker.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery-1.4.4.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Content/HtmlEdit/xheditor-1.1.12-zh-cn.min.js")" type="text/javascript"></script>
<style type="text/css">
.editor-field {
    width: 200px;
}
</style>
<div class="page_content">
    <h2>
        @ViewBag.ShopType - 修改广告信息</h2>
    @using (Html.BeginForm("Edit", "Ad", FormMethod.Post, new { enctype = "multipart/form-data" }))
    {
        <fieldset style="border: 0px;">
            @Html.HiddenFor(model => model.AdId)
            @Html.HiddenFor(model => model.CreateDate)
            @Html.HiddenFor(model => model.EffectiveDays)
            @Html.HiddenFor(model => model.ImgName)
            @Html.HiddenFor(model => model.Status)
            @Html.HiddenFor(model => model.UserID)
            @Html.HiddenFor(model => model.ApprovalDate)
            @Html.HiddenFor(model => model.ApprovalUser)
            <div class="field" style="height: 30px">@Html.ValidationSummary(true, "填写有误!请更正错误，重试!")</div>
            <div class="field">
                <div class="editor-label">
                    广告位置：
                </div>
                <div class="editor-field">
                    @ViewBag.BlockDesc
                </div>
            </div>
            <div class="field">
                <div class="editor-label">
                    区域中位置：
                </div>
                <div class="editor-field">
                    @Html.DropDownList("AdBlockId", (IEnumerable<SelectListItem>)ViewBag.AdBlockList)
                    @Html.ValidationMessageFor(m => m.AdBlockId)
                </div>
                <label>
                    选择广告显示在所选区域的具体位置
                </label>
            </div>
            <div class="field">
                <div class="editor-label">
                    有效期：
                </div>
                <div class="editor-field" style="width: auto">
                    @Html.DisplayFor(model => model.EffectiveDays) 天 (从审核通过之日起算)
                </div>
            </div>
            <div class="field" style="height: auto; margin-bottom:5px;">
                <div class="editor-label">
                    图片：
                </div>
                <div class="editor-field" style="width: auto">
                    <div style="width: @(am.width)px; height: @(am.height)px; border: 1px solid #cccccc; margin-bottom: 5px;">
                        <img alt="@am.name" src="@Url.Content(am.src)" /></div>
                    <div>
                        <input type="file" name="file" id="file" /><label>
                            显示到广告位的图片， <span style="color: Red">规格：@(ViewBag.width)px * @(ViewBag.height)px</span>
                        </label>
                        @Html.ValidationMessageFor(m => m.ImgName)
                    </div>
                </div>
            </div>
            <div class="field">
                <div class="editor-label">
                    文本描述：
                </div>
                <div class="editor-field">
                    @Html.TextBoxFor(m => m.AltText)
                    @Html.ValidationMessageFor(m => m.AltText)
                </div>
                <label>
                    鼠标悬浮时的文本。
                </label>
            </div>
            <div class="field">
                <div class="editor-label">
                    链接地址：
                </div>
                <div class="editor-field">
                    @Html.TextBoxFor(m => m.Href)
                    @Html.ValidationMessageFor(m => m.Href)
                </div>
                <label>
                    图片广告对应的链接地址，如：http://www.kxcxw.com
                </label>
            </div>
            @if (string.IsNullOrEmpty(Model.UserID))
            {
                <div class="field">
                    <div class="editor-label">
                        联系人：
                    </div>
                    <div class="editor-field">
                        @Html.TextBoxFor(m => m.ApplyerName)
                        @Html.ValidationMessageFor(m => m.ApplyerName)
                    </div>
                </div>
                <div class="field">
                    <div class="editor-label">
                        联系电话：
                    </div>
                    <div class="editor-field">
                        @Html.TextBoxFor(m => m.Phone)
                        @Html.ValidationMessageFor(m => m.Phone)
                    </div>
                    <label>
                        用于核对信息时的联系电话，申请后请保持联系畅通。
                    </label>
                </div>
            }
            else
            {
                <div class="field">
                    <div class="editor-label">
                        申请人：
                    </div>
                    <div class="editor-field">
                        @Html.DisplayFor(m => m.ApplyerName)
                        @Html.HiddenFor(m => m.ApplyerName)
                        @Html.HiddenFor(m => m.UserID)
                        @Html.Hidden("Phone", "-")
                    </div>
                </div>
            }
            <div style="float: left; margin-left: 77px; display: inline;">
                <input class="btn_mid" type="submit" value="提交申请" />
            </div>
        </fieldset>
    }
</div>
